import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 导入组件 -- 它默认会找文件夹里的index.vue
import Layout from '@/views/Layout'
import Play from '@/views/Play'
import Home from '@/views/Home'
import Search from '@/views/Search'

const routes = [
  { path: '/', redirect: '/layout/home' },
  { 
    name: 'layout',
    path: '/layout',
    component: Layout,
    children: [
      { 
        name: 'home', 
        path: 'home', 
        component: Home,
        meta: {
          title: '首页-禹崇桂写的'
        }
      },
      { 
        name: 'search', 
        path: 'search', 
        component: Search,
        meta: {
          title: '搜索'
        }
      },
    ]
  },
  { 
    name: 'play',
    path: '/play',
    component: Play
  },
]

const router = new VueRouter({
  routes
})

export default router
